﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WZ.Stock.Data.EF
{
    public class WZDataContext:DbContext
    {
        public WZDataContext()
        {
            Database.SetInitializer<DbContext>(null);
        }
        public static DbSet<Entity.Announcement> AnnouncementData { get; set; }
        public static DbSet<Entity.AnnouncementContent> AnnouncementContentData { get; set; }
        public static DbSet<Entity.Commpany> CommpanyData { get; set; }
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<IncludeMetadataConvention>();     //不创建EdmMetadata表
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();//移除复数表名的契约
            modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();//禁用一对多级联删除
        }
    }
}
